<?
include "/home/ownalbum/public_html/lib.php";

//Mysql settings
define("DB_HOST" , "192.168.1.2");
define("DB_USER" , "root");
define("DB_PASS" , "deep1234");
define("DB_NAME" , "filebin");

//Where to upload files. DO NOT put this in the document root !!!
define("UPLOAD_DIR" , "d:/work/upload/");

$loc = new Local();
$loc->init_db(DB_HOST , DB_USER , DB_PASS);
$loc->use_db(DB_NAME);


$now = time();
$timeframe = 1*1;
$timeframeago = $now-$timeframe;
$sel = mysql_query("select * from filebin_files where date < '".$timeframeago."'");
while($res = mysql_fetch_array($sel)){
	$toUnlink = UPLOAD_DIR . $res['filecode'];
	//echo $toUnlink . "<br />\n";
	@unlink($toUnlink);
	$removeRow = "delete from filebin_files where id='".$res['id']."'";
	//echo $removeRow . "<br /><br />\n";
	mysql_query($removeRow);
}
?>